package magicloan.auctionpocket.ui.activity;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import java.util.ArrayList;
import magicloan.auctionpocket.R;
import magicloan.auctionpocket.adapter.AssetsAdapter;
import magicloan.auctionpocket.bean.ProduceBean;
import magicloan.auctionpocket.ui.base.BaseActivity;

/**
 * Created by hechao on 2018/2/1.
 */
public class AssestActivity extends BaseActivity {

    private AssetsAdapter mAdapter ;
    private ArrayList<ProduceBean> mReDateList ;
    private TextView mTv_coin_detail , mTv_coin_send ;
    private View mViewLeft , mViewRight ;

    @Override
    protected int setContentView() {
        return R.layout.ac_assest;
    }

    @Override
    protected void beforeInitView() {
        mAdapter = new AssetsAdapter(R.layout.ac_assest_re_item, mActivity);
        mAdapter.setOnLoadMoreListener(new MyRequestLoadMoreListener());
        mAdapter.openLoadAnimation(BaseQuickAdapter.ALPHAIN);

        mReDateList = new ArrayList<>() ;
        for ( int i = 0 ; i < 10 ; i ++ ){
            ProduceBean instance = new ProduceBean();
            mReDateList.add(instance);
        }

    }

    @Override
    protected void afterInitView() {

        setTitle("资产明细",null);

        RecyclerView re_right = (RecyclerView) mContentView.findViewById(R.id.recylerv);
        LinearLayoutManager layoutManager_right = new LinearLayoutManager(mContext);
        re_right.setLayoutManager(layoutManager_right);
        re_right.setAdapter(mAdapter);
        mAdapter.addData(mReDateList);
        mAdapter.notifyDataSetChanged();

        mTv_coin_detail = (TextView) findViewById(R.id.tv_coin_detail);
        mTv_coin_send = (TextView) findViewById(R.id.tv_coin_send);

        mViewLeft = findViewById(R.id.view_left);
        mViewRight = findViewById(R.id.view_right);

        findViewById(R.id.ll_left).setOnClickListener(this);

        findViewById(R.id.ll_right).setOnClickListener(this);

    }

    private class MyRequestLoadMoreListener implements BaseQuickAdapter.RequestLoadMoreListener {

        @Override
        public void onLoadMoreRequested() {
//            if (!isLoadMore) {
//                isLoadMore = true;
//                currentPage = ++currentPage;
//                mService.getRefreshLoanData(NetConstance.GetLoanData, currentPage, 6);
//            }
        }

    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initView() {

    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()){
            case R.id.ll_left:
                mTv_coin_detail.setTextColor(mActivity.getResources().getColor(R.color.color_333333));
                mTv_coin_send.setTextColor(mActivity.getResources().getColor(R.color.color_999999));
                mViewLeft.setVisibility(View.VISIBLE);
                mViewRight.setVisibility(View.INVISIBLE);
                break;
            case R.id.ll_right:
                mTv_coin_detail.setTextColor(mActivity.getResources().getColor(R.color.color_999999));
                mTv_coin_send.setTextColor(mActivity.getResources().getColor(R.color.color_333333));
                mViewLeft.setVisibility(View.INVISIBLE);
                mViewRight.setVisibility(View.VISIBLE);
                break;
        }
    }



}
